#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#define pii pair <int, int>
using namespace std;
#ifdef ONLINE_JUDGE

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
	int p = 0, flg = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') flg = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		p = p * 10 + c - '0';
		c = getchar();
	}
	return p * flg;
}
void write(int x) {
	if (x < 0) {
		x = -x;
		putchar('-');
	}
	if (x > 9) {
		write(x / 10);
	}
	putchar(x % 10 + '0');
}
const int N = 2e5 + 5, Sb2N = 2005;
array <pii, N> s;
#define fi first
#define se second
void Sub1(int n, int l) {
	int ans = 0;
	for (int x = 0; x < (1 << n); x++) {
		int xa = 0, xb = 0;
		for (int i = 1; i <= n; i++) {
			if (x & (1 << i - 1))
				xa ^= s[i].fi, xb ^= s[i].se;
		}	
		if (xa <= l) ans = max(ans, xb);
	}
	write(ans), puts("");
}
int f[Sb2N][Sb2N];
void Sub2(int n, int l) {
	for (int i = 1; i <= n; i++)
		for (int j = (1 << 10); ~j; j--)
			f[i][j] = max(f[i - 1][j ^ s[i].fi] ^ s[i].se, f[i - 1][j]);
	int ans = 0;
	for (int j = l; ~j; j--)
		ans = max(ans, f[n][j]);
	write(ans), puts("");
}
int main() {
	freopen("lock.in", "r", stdin);
	freopen("lock.out", "w", stdout);	
	int n = read(), l = read();
	for (int i = 1; i <= n; i++)
		s[i].fi = read(), s[i].se = read();
	if (n <= 23) Sub1(n, l), exit(0);
	if (n <= 2000) Sub2(n, l), exit(0);
}
